package org.jeecg.modules.demo.tj.controller;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONObject;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.demo.tj.service.ITjInfoService;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;

import org.jeecg.modules.demo.dwxx.entity.SysDwxx;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import java.io.OutputStream;
import java.util.Base64;
import java.io.FileOutputStream;

 /**
 * @Description: api
 * @Author: jeecg-boot
 * @Date:   2023-10-27
 * @Version: V1.0
 */
@Api(tags="aj_info")
@RestController
@RequestMapping("/tj/tjInfo")
@Slf4j
public class TjInfoController {
	@Value(value = "${jeecg.path.upload}")
	private String uploadpath;

	 @Value(value = "${jeecg.domainUrl.Dpuburl}")
	 private String Dpuburl;
	@Autowired
	private ITjInfoService tjInfoService;
	@Autowired
	private ISysBaseAPI sysBaseAPI;




	 @ApiOperation(value="查询审核信息", notes="查询审核信息")
	 @GetMapping(value = "/shxx")
	 public String getshxx(HttpServletRequest request, HttpServletResponse response) {
		 LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 String sysOrgCode  = loginUser.getOrgCode();
		 String exeDepartId  = sysBaseAPI.getDepartIdsByOrgCode(sysOrgCode);
		 JSONObject res = tjInfoService.getshxx(sysOrgCode,loginUser.getId());
		 String retStr = res.toJSONString();
		 return retStr;
	 }


	 @ApiOperation(value="查询人员信息", notes="查询人员信息")
	 @GetMapping(value = "/ryxx")
	 public String getryxx(HttpServletRequest request, HttpServletResponse response) {
		 LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 String sysOrgCode  = loginUser.getOrgCode();
		 String exeDepartId  = sysBaseAPI.getDepartIdsByOrgCode(sysOrgCode);
		 JSONObject res = tjInfoService.getryxx(sysOrgCode,loginUser.getId());
		 String retStr = res.toJSONString();
		 return retStr;
	 }

	 @ApiOperation(value="查询安置方式统计信息", notes="查询人员信息")
		 @GetMapping(value = "/azfstjxx")
	 public String getazfstjxx(HttpServletRequest request, HttpServletResponse response) {
		 LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 String sysOrgCode  = loginUser.getOrgCode();
		 String exeDepartId  = sysBaseAPI.getDepartIdsByOrgCode(sysOrgCode);
		 JSONObject res = tjInfoService.getazfstjxx(sysOrgCode,loginUser.getId());
		 String retStr = res.toJSONString();
		 return retStr;
	 }

	 @ApiOperation(value="查询健康状况统计信息", notes="查询人员信息")
	 @GetMapping(value = "/jktjxx")
	 public String getjktjxx(HttpServletRequest request, HttpServletResponse response) {
		 LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 String sysOrgCode  = loginUser.getOrgCode();

		 String exeDepartId  = sysBaseAPI.getDepartIdsByOrgCode(sysOrgCode);
		 JSONObject res = tjInfoService.getjktjxx(sysOrgCode,loginUser.getId());
		 String retStr = res.toJSONString();
		 return retStr;
	 }


	 @ApiOperation(value="查询安置地统计信息", notes="查询人员信息")
	 @GetMapping(value = "/azdtjxx")
	 public String getazdtjxx(HttpServletRequest request, HttpServletResponse response) {
		 LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 String sysOrgCode  = loginUser.getOrgCode();
		 String exeDepartId  = sysBaseAPI.getDepartIdsByOrgCode(sysOrgCode);
		 JSONObject res = tjInfoService.getazdtjxx(sysOrgCode,loginUser.getId());
		 String retStr = res.toJSONString();
		 return retStr;
	 }

	 @ApiOperation(value="查询人员统计信息", notes="查询人员信息")
	 @GetMapping(value = "/rytjxx")
	 public String getrytjxx(HttpServletRequest request, HttpServletResponse response) {
		 LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
		 String sysOrgCode  = loginUser.getOrgCode();
		 String exeDepartId  = sysBaseAPI.getDepartIdsByOrgCode(sysOrgCode);
		 JSONObject res = tjInfoService.getrytjxx(sysOrgCode,loginUser.getId());
		 String retStr = res.toJSONString();
		 return retStr;
	 }

}
